package com.example.mall.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.mall.util.CodeGenerateUtils;
import lombok.Data;

import java.io.Serializable;

/**
 * <p>
 * 订单主表
 * </p>
 *
 * @author whale
 * @since 2025-05-09
 */
@TableName("tb_order")
@Data
public class Order extends Model<Order> {

    private static final long serialVersionUID = 1L;

    /**
     * 订单唯一标识
     */
    @TableId("order_id")
    private Long orderId;
    /**
     * 用户ID
     */
    @TableField("user_id")
    private Long userId;
    /**
     * 订单状态（0：待支付，1：已支付，2：已发货，3：已完成，4：已取消，5：退款中，6：已退款）
     */
    @TableField("order_status")
    private Integer orderStatus;
    /**
     * 订单总金额
     */
    @TableField("total_amount")
    private BigDecimal totalAmount;
    /**
     * 优惠金额
     */
    @TableField("discount_amount")
    private BigDecimal discountAmount;
    private String orderNo;
    private String title;
    /**
     * 实际支付金额
     */
    @TableField("final_amount")
    private BigDecimal finalAmount;
    /**
     * 支付方式（如微信支付、支付宝、信用卡）
     */
    @TableField("payment_method")
    private String paymentMethod;
    /**
     * 支付状态（0：待支付，1：已支付，2：支付失败 3支付取消）
     */
    @TableField("payment_status")
    private Integer paymentStatus;
    @TableField("create_date")
    private Date createDate;
    @TableField("update_date")
    private Date updateDate;

    public Order() {
        this.orderId = Long.valueOf(CodeGenerateUtils.generateUniqueId());
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public BigDecimal getFinalAmount() {
        return finalAmount;
    }

    public void setFinalAmount(BigDecimal finalAmount) {
        this.finalAmount = finalAmount;
    }

    public String getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(String paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public Integer getPaymentStatus() {
        return paymentStatus;
    }

    public void setPaymentStatus(Integer paymentStatus) {
        this.paymentStatus = paymentStatus;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }


    @Override
    public String toString() {
        return "Order{" +
        ", orderId=" + orderId +
        ", userId=" + userId +
        ", orderStatus=" + orderStatus +
        ", totalAmount=" + totalAmount +
        ", discountAmount=" + discountAmount +
        ", finalAmount=" + finalAmount +
        ", paymentMethod=" + paymentMethod +
        ", paymentStatus=" + paymentStatus +
        ", createDate=" + createDate +
        ", updateDate=" + updateDate +
        "}";
    }
}
